import {
  PrimaryGeneratedColumn,
  Column,
  Entity,
  ManyToOne,
  JoinColumn,
} from 'typeorm';
import { CarBrand } from '../car_brand/car_brand.entity';
@Entity('car_model')
export class CarModel {
  @PrimaryGeneratedColumn({
    comment: '型号id',
  })
  id: number;

  @Column({
    comment: '品牌id',
  })
  brand_id: number;

  @Column({
    comment: '型号名称',
  })
  name: string;

  @Column({
    comment: '名称首字母',
  })
  first_letter: string;

  @ManyToOne(() => CarBrand, (CarBrand) => CarBrand.name, { eager: true })
  @JoinColumn({ name: 'brand_id' })
  carBrand: CarBrand;
}
